import request from '@/utils/request'
import { encryptionData } from '@/utils/com'
import Qs from 'qs'
/* 获取营销活动详情 */
export function jcdMarketingActivitiesGet(data) {
  return request({
    url: `/jcdGys/jcdMarketingActivities/get/${data.id}`,
    method: 'get',
    headers: encryptionData(data, `/jcdGys/jcdMarketingActivities/get/${data.id}`),
  })
}
/* 分页获取营销活动 */
export function jcdMarketingActivitiesPage(data) {
  return request({
    url: '/jcdGys/jcdMarketingActivities/page',
    method: 'get',
    headers: encryptionData(data, '/jcdMarketingActivities/page'),
    params: data
  })
}
/* 产品sku列表 */
export function queryAllSkuMaterialsPage(data) {
  return request({
    url: '/jcdGys/jcdMaterialsSku/queryAllSkuMaterialsPage',
    method: 'get',
    headers: encryptionData(data, '/jcdMaterialsSku/queryAllSkuMaterialsPage'),
    params: data
  })
}
/* 优惠券\代金券分页列表 */
export function jcdCashCouponPage(data) {
  return request({
    url: '/jcdGys/jcdCashCoupon/page',
    method: 'get',
    headers: encryptionData(data, '/jcdCashCoupon/page'),
    params: data
  })
}
/* 根据营销活动产品id获取sku列表 */
export function jcdMarketingMaterialsSkuList(data) {
  return request({
    url: `/jcdGys/jcdMarketingMaterialsSku/list/${data.materialsId}`,
    method: 'get',
    headers: encryptionData(data, `/jcdGys/jcdMarketingMaterialsSku/list/${data.materialsId}`),
  })
}
/* 选择参与营销活动的产品 */
export function selectProductPage(data) {
  return request({
    url: `/jcdGys/jcdMarketingMaterials/selectProductPage`,
    method: 'get',
    headers: encryptionData(data, `/jcdGys/jcdMarketingMaterials/selectProductPage`),
    params: data
  })
}
/* 新增营销活动 */
export function jcdMarketingActivitiesSave(data) {
  return request({
    url: '/jcdGys/jcdMarketingActivities/save',
    method: 'post',
    headers: encryptionData(data, '/jcdMarketingActivities/save'),
    data: Qs.stringify(data)
  })
}
/* 新增或修改营销活动产品的sku */
export function saveOrUpdateBatch(data) {
  return request({
    url: '/jcdGys/jcdMarketingMaterialsSku/saveOrUpdateBatch',
    method: 'post',
    headers: encryptionData(data, '//jcdMarketingMaterialsSku/saveOrUpdateBatch'),
    data: Qs.stringify(data)
  })
}
/* 新增产品 */
export function jcdMarketingActivitiesSaveBatch(data) {
  return request({
    url: '/jcdGys/jcdMarketingMaterials/saveBatch',
    method: 'post',
    headers: encryptionData(data, '/jcdMarketingMaterials/saveBatch'),
    data: Qs.stringify(data)
  })
}
/* 修改营销活动 */
export function jcdMarketingActivitiesEdit(data) {
  return request({
    url: '/jcdGys/jcdMarketingActivities/edit',
    method: 'put',
    headers: encryptionData(data, '/jcdMarketingActivities/edit'),
    data: Qs.stringify(data)
  })
}/* 修改营销活动产品状态 */
export function jcdMarketingMaterialsUpdate(data) {
  return request({
    url: '/jcdGys/jcdMarketingMaterials/update',
    method: 'put',
    headers: encryptionData(data, '/jcdMarketingMaterials/update'),
    data: Qs.stringify(data)
  })
}
/* 营销活动开启/关闭 */
export function jcdMarketingActivitiesupdate(data) {
  return request({
    url: '/jcdGys/jcdMarketingActivities/update',
    method: 'put',
    headers: encryptionData(data, '/jcdGys/jcdMarketingActivities/update'),
    data: Qs.stringify(data)
  })
}
/* 删除营销活动产品 */
export function jcdMarketingMaterialsdelete(data) {
  return request({
    url: `/jcdGys/jcdMarketingMaterials/delete/${data.id}`,
    method: 'DELETE',
    headers: encryptionData(data, `/jcdGys/jcdMarketingMaterials/delete/${data.id}`)
  })
}
/* 删除营销活动 */
export function jcdMarketingActivitiesdelete(data) {
  return request({
    url: `/jcdGys/jcdMarketingActivities/delete/${data.id}`,
    method: 'DELETE',
    headers: encryptionData(data, `/jcdGys/jcdMarketingActivities/delete/${data.id}`)
  })
}
/* pc分页获取营销活动产品列表 */
export function jcdMarketingMaterialspage(data) {
  return request({
    url: `/jcdGys/jcdMarketingMaterials/page`,
    method: 'get',
    headers: encryptionData(data, `jcdMarketingMaterials/page`),
    params: data
  })
}
